/**
 * 智能体相关API接口
 */

import { request } from '@/utils/request';

// 类型定义
export interface Agent {
  id?: number;
  createTime?: string;
  updateTime?: string;
  name: string;
  systemPrompt: string;
  trainable: boolean;
  version?: number;
  status?: string;
}

// 获取智能体列表
export async function getAllAgents(): Promise<Agent[]> {
  return request.get('/api/agents/list');
}

// 获取单个智能体
export async function getAgentById(id: number): Promise<Agent> {
  return request.get('/api/agents/get', { params: { id } });
}

// 获取特定状态的智能体
export async function getAgentsByStatus(status: string): Promise<Agent[]> {
  return request.get('/api/agents/status', { params: { status } });
}

// 创建智能体
export async function createAgent(data: Agent): Promise<Agent> {
  return request.post('/api/agents/create', data);
}

// 更新智能体
export async function updateAgent(id: number, data: Agent): Promise<Agent> {
  return request.put(`/api/agents/update?id=${id}`, data);
}

// 更新智能体状态
export async function updateAgentStatus(id: number, status: string): Promise<Agent> {
  return request.put('/api/agents/status', null, { params: { id, status } });
}

// 更新智能体系统提示词
export async function updateAgentSystemPrompt(id: number, systemPrompt: string): Promise<Agent> {
  return request.put(`/api/agents/prompt?id=${id}`, systemPrompt);
}

// 删除智能体
export async function deleteAgent(id: number): Promise<void> {
  return request.delete('/api/agents/delete', { params: { id } });
} 